package controllers;

/**
 * Created by grzegorz on 10/10/14.
 * Public enum providing ranks for {@link Card}s.
 */
public enum Ranks {
	ACE ("A"), TWO ("2"), THREE ("3"), FOUR ("4"), FIVE ("5"), SIX ("6"), SEVEN ("7"), EIGHT ("8"), NINE ("9"), TEN ("10"), JACK ("J"), QUEEN ("Q"), KING ("K");
	
	private String value;

	private Ranks( String s ) {
		this.value = s;
	}

	@Override
	public String toString() {
		return value;
	}

	public static Ranks getRank( String value ) {
		for( Ranks rank : values() ) {
			if( rank.value.equalsIgnoreCase( value ) )
				return rank;
		}
		throw new IllegalArgumentException( "Non-existent rank: " + value );
	}
}
